<template>
	<view class="content">
		<view class="content-block">
			<view class="article-tab" style="display: flex; width: 300rpx;border: 1px solid red;justify-content: center;">
				<view @click.prevent="noticeActive=1" style="border-top-left-radius: 10rpx;border-bottom-left-radius: 10rpx ;" :class="noticeActive===1?'active':''" class="tab-item">汉文</view>
				<view @click.prevent="noticeActive=2" style="border-top-right-radius: 10rpx;border-bottom-right-radius: 10rpx ;" :class="noticeActive===2?'active':''" class="tab-item">蒙文</view>
			</view>
			<template v-if="noticeActive==1">
				<view class="title">{{detail.title}}</view>
				<view class="sub-title">发布时间：{{detail.crt_time}}</view>
				<view class="article-content">
					<mp-html :content="detail.content" />
				</view>
			</template>
			<template v-if="noticeActive==2">
				<view class="article-content">
					<mp-html :content="detail.mong_content" />
				</view>
			</template>

		</view>
		<view class="apply-btn" v-if="type==3">在线申请</view>
	</view>
</template>

<script>
	import {
		getNewByIdApi
	} from '@/api/news.js';
	export default {
		data() {
			return {
				userIdentity: 0,
				noticeActive: 1,
				detail: {
					title: '',
					crt_time: '',
					content: '',
					mong_content: ''
				},
				id: null,
			}
		},
		methods: {
			getNew(id) {
				getNewByIdApi({
					id: this.id
				}).then((res) => {
					this.detail = res[0]
				}).catch((res) => {
				})
			},
		},
		onLoad(e) {
			this.id = e.id;
			this.getNew();

		},
		onShow() {
			this.userIdentity = this.$store.state.userIdentity;
		}
	}
</script>

<style lang="scss">
	page {
		background: #EFEFEF;
	}
	img {
		max-width: 100%;
	}
	.content {
		width: 100%;
		padding-bottom: 20rpx;

		.content-block {
			background-color: #fff;
			padding: 30rpx;

			.title {
				font-size: 40rpx;
				font-weight: bold;
				margin-bottom: 30rpx;
			}

			.sub-title {
				font-size: 28rpx;
				color: #999;
				margin-bottom: 30rpx;
			}
		}
		
		.article-tab {
			margin: 0 auto;
			margin-bottom: 20rpx;
			height: 70rpx;
			box-shadow: 0px 0px 4px 3px #e5e5e5;
			border-radius: 10rpx;
		}
		
		.tab-item {
			width: 50%;
			height: 100%;
			text-align: center;
			background-color: #fff;
			color: red;
			line-height: 70rpx;
		}
		
		.tab-item.active {
			background-color: red;
			color: #fff;
		}


	}
</style>
